<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>Demo</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <link rel="stylesheet" th:href="@{/plugins/layui/css/layui.css}"/>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-cyan">layout demo</div>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"
                         class="layui-nav-img">
                    tester
                    <i class="layui-icon layui-icon-down layui-nav-more"></i></a>
                <dl class="layui-nav-child">
                    <dd><a href="">Your Profile</a></dd>
                    <dd><a href="">Settings</a></dd>
                    <dd><a href="">Sign out</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect="">
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
            <span class="layui-nav-bar"></span></ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">menu group 1<i
                            class="layui-icon layui-icon-down layui-nav-more"></i></a>
                    <dl class="layui-nav-child">
                        <dd><a>menu 1</a></dd>
                        <dd><a href="#dashboard">menu 2</a></dd>
                        <dd><a href="javascript:;">menu 3</a></dd>
                        <dd><a href="">the links</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" id="asdsa">menu group 2<i class="layui-icon layui-icon-down layui-nav-more"></i></a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">list 1</a></dd>
                        <dd><a href="javascript:;">list 2</a></dd>
                        <dd><a href="">超链接</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="javascript:;">click menu item</a></li>
                <li class="layui-nav-item"><a href="">the links</a></li>
                <span class="layui-nav-bar"></span></ul>
        </div>
    </div>
    <div class="layui-body" id="layui-body"></div>
    <div class="layui-footer">
        底部固定区域
    </div>
</div>
<script th:src="@{/plugins/layui/layui.js}"></script>
<script>
    //JS
    layui.use(['element', 'layer', 'util'], function () {
        const element = layui.element
            , layer = layui.layer
            , util = layui.util
            , $ = layui.$;
        layui.config({
            base: 'plugins/',
            version: new Date().valueOf()
        }).extend({
            layrouter: 'layrouter/js/layrouter'
        }).use(['layrouter', 'layer', 'element'], function () {
            let layRouter = layui.layrouter;
            let layer = layui.layer;
            let element = layui.element;
            let layApp = $('#layui-body');
            // 注册一些路由
            layRouter.register('dashboard', function () {
                $.ajax({
                    url: 'dashboard'
                }).done(function (result) {
                    result = String(result)
                        .replace(/<(title|link)([\s\>])/gi, '<div class="hidden ajax-append-$1"$2')
                        .replace(/<\/(title|link)\>/gi, '</div>')
                    layApp.empty().html(result);
                });
            });
            // 初始化
            // 监听 hash 事件
            layRouter.init();
        });
    });
</script>
</body>

</html>
